package tool;

import javax.microedition.media.Control;
import javax.microedition.media.Player;
import javax.microedition.media.control.VolumeControl;

public class PlayerUtils {

	public static VolumeControl getVolumeControl(Player aPlayer) {
        Control[] controls = aPlayer.getControls();
        VolumeControl volumeControl = null;
        
        for (int i = 0; i < controls.length; i++) {
            if (controls[i] instanceof VolumeControl) {            	
            	volumeControl = (VolumeControl) controls[i];
            }
        }
        return volumeControl;
	}

	public static int getVolumeValue(int nightModeIndex) {
		// Index mode varying from 5 to 1
		int[] volumes = new int[] {5, 10, 20, 30, 60};
		return volumes[nightModeIndex - 1];
	}
	
}
